package com.qk.controller;

import com.qk.Vo.LoginResultVo;
import com.qk.common.Result;
import com.qk.entity.User;
import com.qk.server.UserServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginControlller {
    @Autowired
    private UserServer userServer;
    @PostMapping("/login")
    public Result login(@RequestBody User user){
        LoginResultVo loginResultVo = userServer.loginUser(user);
        if (loginResultVo == null){
            return Result.error("登录失败");
        }
        return Result.success(loginResultVo);
    }
}
